package com.kedacom.demo.modularity.core;

import javax.ws.rs.core.Response;
import javax.ws.rs.ext.Provider;

/**
 * ResponseExceptionMapper，将response中的业务类异常json对象反序列化成BusinessException
 * @author luocanfeng
 * @date 2013-8-23
 */
@Provider
public class ResponseExceptionMapper implements org.apache.cxf.jaxrs.client.ResponseExceptionMapper<BusinessException> {

	@Override
	public BusinessException fromResponse(Response response) {
		BusinessExceptionEntity entity = response.readEntity(BusinessExceptionEntity.class);
		return entity.toBusinessException();
	}

}
